﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using BADDGUI.Utils.SQLHelper;

namespace BADDGUI
{
    public static class BLCGlobalData
    {
        public static DBHandler BASLOG;

        static internal DataTable dtMenu;
        static internal DataTable dtNodes;

        public static Font AppFont = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

        private static void InitializeDatabase()
        {
            DBHandler myDBHandler = new DBHandler(Properties.Settings.Default.BASELOG_DATA);
            BASLOG = myDBHandler;
        }

        private static void InitializeDatabase(string ConnectionString)
        {
            DBHandler myDBHandler = new DBHandler(ConnectionString);
            BASLOG = myDBHandler;
        }

        public static void InitializeData()
        {
            InitializeDatabase();
            dtMenu = BASLOG.GetAView("vw_fmmd1", "Sort");
            dtNodes = BASLOG.GetAView("vw_fmnd1", "Sort");
        }

        public static void InitializeData(string ConnectionString)
        {
            InitializeDatabase(ConnectionString);
            dtMenu = BASLOG.GetAView("vw_fmmd1", "Sort");
            dtNodes = BASLOG.GetAView("vw_fmnd1", "Sort");
        }

        public static DataTable DtMenu
        {
            get { return BLCGlobalData.dtMenu; }
            set { BLCGlobalData.dtMenu = value; }
        }

        public static DataTable DtNodes
        {
            get { return BLCGlobalData.dtNodes; }
            set { BLCGlobalData.dtNodes = value; }
        }
    }
}
